import { Body, Controller, Post } from '@nestjs/common';
import { LoginTdo } from '../dto/login.dto';
import { responseWrapper } from 'src/utils';
import { LoginService } from '../services/login.service';
import { CommonResponse } from 'src/types';

@Controller('login')
export class LoginController {
  constructor(
    private readonly loginService: LoginService, // private readonly toolsService: ToolsService
  ) {}
  @Post()
  async login(@Body() data: LoginTdo): Promise<CommonResponse> {
    try {
      const res = await this.loginService.login(data);
      return responseWrapper(res);
    } catch (error) {
      return responseWrapper(error, true);
    }
  }
}
